//
//  DYCurrencySelectCell.m
//  DaYing
//
//  Created by DaYing  on 2023.
//  Copyright © 2023年 DaYing . All rights reserved.
//

#import "DYCurrencySelectCell.h"

@implementation DYCurrencySelectCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    // Background Code
}

- (void)setData:(id)data delegate:(id)delegate {
    _delegate = delegate;
    
    if ([data isKindOfClass:[NSDictionary class]]) {
        if ([data[@"data"] isKindOfClass:[DYCurrencySelectCellModel class]]) {
            DYCurrencySelectCellModel *model = data[@"data"];
            _model = model;
                        
            NSString *title = model.dic[@"title"];
            _titleLabel.text = kSafeString(title);
            
            if ([_titleLabel.text isEqualToString:@"服务条款"]) {
                _viewTop.constant = 0;
                _viewBottom.constant = -15;
            } else if ([_titleLabel.text isEqualToString:@"隐私政策"]) {
                _viewTop.constant = -15;
                _viewBottom.constant = 0;
            }
        }
    }
}

- (IBAction)buttonAction:(UIButton *)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(currencySelectCell:button:)]) {
        [_delegate currencySelectCell:self button:sender];
    }
}

@end


#pragma mark - Model

@implementation DYCurrencySelectCellModel

+ (DYCurrencySelectCellModel *)ittemModelWithDic:(NSDictionary *)dic {
    DYCurrencySelectCellModel *model = [DYCurrencySelectCellModel new];
    model.dic = dic;
    return model;
}

@end
